var REPORT_PATH_PREFIX = "";

function setRegulatoryReportPath(path){
	REPORT_PATH_PREFIX =  path;
}

$(function() {
	$('#reportType').select2({
		placeholder : "报告类型"
	});
	WASP_WIDGET.triggerDateStyleWithYMD("#reportDate");
	WASP_WIDGET.triggerPrdInfoSelect("prdCode");
	initValidate();
});

//表单验证
function initValidate(){
	 $("#regulatoryReportForm").validate({
	        focusCleanup: true,
	        ignore : "",
	        rules: {
	        	prdCode:{
	            	required: true	
	            },
	            reportType:{
	            	required: true
	            },	
	            reportDate : {
	            	required: true
				},
	        },
	        messages: {
	        	prdCode : "请选择产品",
	        	reportType : "请选择报告类型",
	        	reportDate : "请选择报告日期",
	        }
	    });
	 
}

function submitRegulatoryReportForm() {
	// 附件ID放进隐藏域
	var attIds = serialAttId("attachContainerregulatoryReportModule");
	if(attIds){
		attIds = attIds.replace(/(^,)|(,$)/g,'');
	}
	$('#regAttIds').val(attIds);
	SubmitAndPreventSecond("regulatoryReportForm", submitUrl("/addRegulatoryReport.do"), null, "submitBtn");//修改
}

function submitUrl(urlMethod){
	var url = REPORT_PATH_PREFIX + urlMethod;
	document.regulatoryReportForm.action = url;
}

